{
 "cells": [
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "定义网络",
   "id": "c69d2e040d0affcc"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:30:54.097418Z",
     "start_time": "2025-01-08T07:30:54.089367Z"
    }
   },
   "cell_type": "code",
   "source": [
    "import numpy\n",
    "class neuralnetwork:\n",
    "    def __init__(self,input_size,hidden_size,output_size,learning_rate):\n",
    "        self.input_size = input_size\n",
    "        self.hidden_size = hidden_size\n",
    "        self.output_size = output_size\n",
    "        self.lr = learning_rate\n",
    "        # #简单初始化\n",
    "        # self.in_hiw = numpy.random.rand(self.hidden_size, self.input_size)-0.5\n",
    "        # self.hi_outw = numpy.random.rand(self.output_size, self.hidden_size)-0.5\n",
    "        #复杂初始化\n",
    "        self.in_hiw=numpy.random.normal(0.0,pow(self.hidden_size,-0.5),(self.hidden_size,self.input_size))\n",
    "        self.hi_outw=numpy.random.normal(0.0,pow(self.output_size,-0.5),(self.output_size,self.hidden_size))\n",
    "\n",
    "    def sigmoid(self,x):\n",
    "        s = 1 / (1 + numpy.exp(-x))\n",
    "        return s\n",
    "\n",
    "    def train(self,train_x,train_y):\n",
    "        #前向\n",
    "        inputs=numpy.array(train_x,ndmin=2).T\n",
    "        targets=numpy.array(train_y,ndmin=2).T\n",
    "        hidden_in = numpy.dot(self.in_hiw, inputs)\n",
    "        hidden_out = self.sigmoid(hidden_in)\n",
    "        out_in = numpy.dot(self.hi_outw, hidden_out)\n",
    "        final_outputs = self.sigmoid(out_in)\n",
    "        #后向\n",
    "        output_error = targets - final_outputs\n",
    "        hidden_error=numpy.dot((self.hi_outw).T,output_error)\n",
    "        #更新参数\n",
    "        din_hiw=numpy.dot((hidden_error*hidden_out*(1-hidden_out)),inputs.T)\n",
    "        dhi_outw=numpy.dot((output_error*final_outputs*(1-final_outputs)),hidden_out.T)\n",
    "        self.in_hiw+=self.lr*din_hiw\n",
    "        self.hi_outw+=self.lr*dhi_outw\n",
    "    def query(self,test_x):\n",
    "        inputs=numpy.array(test_x,ndmin=2).T\n",
    "        hidden_in=numpy.dot(self.in_hiw,inputs)\n",
    "        hidden_out=self.sigmoid(hidden_in)\n",
    "        out_in=numpy.dot(self.hi_outw,hidden_out)\n",
    "        out_out=self.sigmoid(out_in)\n",
    "        return out_out"
   ],
   "id": "5cce16c77f18c75a",
   "outputs": [],
   "execution_count": 80
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "加载数据",
   "id": "ac1f136eb348657e"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:30:54.112606Z",
     "start_time": "2025-01-08T07:30:54.106960Z"
    }
   },
   "cell_type": "code",
   "source": [
    "import numpy\n",
    "import matplotlib.pyplot\n",
    "data_file=open(r'E:\\sorce\\dataset\\mnist_dataset\\mnist_train_100.csv','r')\n",
    "data_list=data_file.readlines()\n",
    "data_file.close()\n",
    "len(data_list)"
   ],
   "id": "27a2796dc6eb4d8c",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "100"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 81
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:30:54.233892Z",
     "start_time": "2025-01-08T07:30:54.131178Z"
    }
   },
   "cell_type": "code",
   "source": [
    "all_values=data_list[0].split(',')\n",
    "all_values = [float(value) for value in all_values[1:]]\n",
    "image_array=numpy.asfortranarray(all_values).reshape(28,28)\n",
    "matplotlib.pyplot.imshow(image_array,cmap='Greys',interpolation='none')"
   ],
   "id": "c37515818622c0cb",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x20d4e611040>"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaEAAAGdCAYAAAC7EMwUAAAAOXRF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Dtw4IBraGhwe/fudaNGjXLf+973OtVxePbZZ10oFHK1tbWuqakpcfvqq68Sj+kK58PtjkM2nQ9ZEyHnnHv11VddSUmJ69Wrl3v44YeTXo7YFcycOdNFIhHXs2dPV1RU5KZPn+6OHTtmvayM27t3r5PU7jZ79mzn3NWX5b744osuHA67YDDoxo0b544ePWq76Ay41XH46quvXFlZmevbt6/r2bOnu//++93s2bPdqVOnrJedVjf6+0ty69atSzymK5wPtzsO2XQ+8KscAABmsuI5IQBA50SEAABmiBAAwAwRAgCYIUIAADNECABghggBAMwQIQCAGSIEADBDhAAAZogQAMAMEQIAmPl/BSlmIMPKRr4AAAAASUVORK5CYII="
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 82
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "数据预处理",
   "id": "924100d3a301229a"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:30:54.276464Z",
     "start_time": "2025-01-08T07:30:54.269019Z"
    }
   },
   "cell_type": "code",
   "source": [
    "scaled_input=numpy.asfortranarray(all_values)/255.0*0.99+0.01\n",
    "print(scaled_input)"
   ],
   "id": "b24260072f390441",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.02164706 0.07988235 0.07988235 0.07988235\n",
      " 0.49917647 0.538      0.68941176 0.11094118 0.65447059 1.\n",
      " 0.96894118 0.50305882 0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.12647059 0.14976471 0.37494118 0.60788235\n",
      " 0.67       0.99223529 0.99223529 0.99223529 0.99223529 0.99223529\n",
      " 0.88352941 0.67776471 0.99223529 0.94952941 0.76705882 0.25847059\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.20023529\n",
      " 0.934      0.99223529 0.99223529 0.99223529 0.99223529 0.99223529\n",
      " 0.99223529 0.99223529 0.99223529 0.98447059 0.37105882 0.32835294\n",
      " 0.32835294 0.22741176 0.16141176 0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.07988235 0.86023529 0.99223529\n",
      " 0.99223529 0.99223529 0.99223529 0.99223529 0.77870588 0.71658824\n",
      " 0.96894118 0.94564706 0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.32058824 0.61564706 0.42541176 0.99223529\n",
      " 0.99223529 0.80588235 0.05270588 0.01       0.17694118 0.60788235\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.06435294 0.01388235 0.60788235 0.99223529 0.35941176\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.54964706 0.99223529 0.74764706 0.01776471 0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.05270588\n",
      " 0.74764706 0.99223529 0.28176471 0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.14588235 0.94564706\n",
      " 0.88352941 0.63117647 0.42929412 0.01388235 0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.32447059 0.94176471 0.99223529\n",
      " 0.99223529 0.472      0.10705882 0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.18470588 0.73211765 0.99223529 0.99223529\n",
      " 0.59235294 0.11482353 0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.07211765 0.37105882 0.98835294 0.99223529 0.736\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.97670588 0.99223529 0.97670588 0.25847059 0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.18858824 0.51470588 0.72047059 0.99223529\n",
      " 0.99223529 0.81364706 0.01776471 0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.16141176 0.58458824\n",
      " 0.89905882 0.99223529 0.99223529 0.99223529 0.98058824 0.71658824\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.10317647 0.45258824 0.868      0.99223529 0.99223529 0.99223529\n",
      " 0.99223529 0.79035294 0.31282353 0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.09929412 0.26623529 0.83694118 0.99223529\n",
      " 0.99223529 0.99223529 0.99223529 0.77870588 0.32447059 0.01776471\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.07988235 0.67388235\n",
      " 0.86023529 0.99223529 0.99223529 0.99223529 0.99223529 0.76705882\n",
      " 0.32058824 0.04494118 0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.22352941 0.67776471 0.88741176 0.99223529 0.99223529 0.99223529\n",
      " 0.99223529 0.95729412 0.52635294 0.05270588 0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.538      0.99223529\n",
      " 0.99223529 0.99223529 0.83305882 0.53411765 0.52247059 0.07211765\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01       0.01       0.01\n",
      " 0.01       0.01       0.01       0.01      ]\n"
     ]
    }
   ],
   "execution_count": 83
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:30:54.284134Z",
     "start_time": "2025-01-08T07:30:54.280456Z"
    }
   },
   "cell_type": "code",
   "source": [
    "targets=numpy.zeros(10)+0.01\n",
    "targets[int(all_values[0])]=0.99\n",
    "print(targets)"
   ],
   "id": "1fbc5bea0285b141",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.99 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01]\n"
     ]
    }
   ],
   "execution_count": 84
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "开始训练",
   "id": "9a3f4fd46c87ec06"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:30:54.343490Z",
     "start_time": "2025-01-08T07:30:54.301893Z"
    }
   },
   "cell_type": "code",
   "source": [
    "input_nodes=784\n",
    "hidden_nodes=100\n",
    "output_nodes=10\n",
    "learning_rate=0.3\n",
    "n=neuralnetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)\n",
    "training_data_file=open(r'E:\\sorce\\dataset\\mnist_dataset\\mnist_train_100.csv','r')\n",
    "training_data_list=training_data_file.readlines()\n",
    "training_data_file.close()\n",
    "for record in training_data_list:\n",
    "    all_values=record.split(',')\n",
    "    all_values = [float(value) for value in all_values[1:]]\n",
    "    inputs=numpy.asfortranarray(all_values)/255.0*0.99+0.01\n",
    "    targets=numpy.zeros(10)+0.01\n",
    "    targets[int(all_values[0])]=0.99\n",
    "    n.train(inputs,targets)"
   ],
   "id": "5f1f22b8df5b08bc",
   "outputs": [],
   "execution_count": 85
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "测试网络",
   "id": "720acfd726e64ced"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:30:54.368450Z",
     "start_time": "2025-01-08T07:30:54.363227Z"
    }
   },
   "cell_type": "code",
   "source": [
    "test_data_file=open(r'E:\\sorce\\dataset\\mnist_dataset\\mnist_test_10.csv','r')\n",
    "test_data_list=test_data_file.readlines()\n",
    "test_data_file.close()\n",
    "test_all_values=test_data_list[0].split(',')\n",
    "print(len(test_data_list))\n",
    "print(test_all_values[0])\n",
    "print(len(test_all_values))\n"
   ],
   "id": "5b89c5a1f85cc17d",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10\n",
      "7\n",
      "785\n"
     ]
    }
   ],
   "execution_count": 86
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:30:54.506784Z",
     "start_time": "2025-01-08T07:30:54.388120Z"
    }
   },
   "cell_type": "code",
   "source": [
    "test_all_values = [float(value) for value in test_all_values[1:]]\n",
    "test_image_array=numpy.asfortranarray(all_values).reshape(28,28)\n",
    "test_target=numpy.zeros(10)+0.01\n",
    "matplotlib.pyplot.imshow(test_image_array,cmap='Greys',interpolation='none')\n",
    "print(n.query(numpy.asfortranarray(test_all_values)/255.0*0.99+0.01))"
   ],
   "id": "66eb97255308a1df",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0.9867288 ]\n",
      " [0.01791324]\n",
      " [0.02431913]\n",
      " [0.00987302]\n",
      " [0.0100507 ]\n",
      " [0.02161364]\n",
      " [0.02035052]\n",
      " [0.01494483]\n",
      " [0.01690283]\n",
      " [0.01130217]]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ],
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaEAAAGdCAYAAAC7EMwUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAY5UlEQVR4nO3df2jU9x3H8df566bucpJpcnczzcJQNlSEqlND/VVmMGxSm45ZCyP+I22NgqSlzLrNbAPTOSqOZbWsDKddbaVgnUOpzaaJFZvNhhTFiaQ11gxzC2b2LqZ6Qf3sD/Homfjje975ziXPB3yhuft+vLfffskzX+9HfM45JwAADAyzHgAAMHQRIQCAGSIEADBDhAAAZogQAMAMEQIAmCFCAAAzRAgAYGaE9QC3u3Hjhi5cuKBAICCfz2c9DgDAI+ecuru7FYlENGzY3a91BlyELly4oKKiIusxAAAPqL29XRMnTrzrPgMuQoFAQNLN4fPy8oynAQB4FY/HVVRUlPx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nnQrVqxw4XDYxeNx48kz627Hobu7273wwgvu2LFjrq2tzR0+fNjNnTvXffOb3xxUx+H55593wWDQNTQ0uI6OjuT25ZdfJvcZCufDvY5DLp0PORMh55z7wx/+4IqLi92oUaPco48+mvJyxKFg+fLlLhwOu5EjR7pIJOIqKircqVOnrMfKusOHDztJfbbKykrn3M2X5W7cuNGFQiHn9/vd/Pnz3cmTJ22HzoK7HYcvv/zSlZWVuQkTJriRI0e6Rx55xFVWVrrz589bj51R/f39Jbnt27cn9xkK58O9jkMunQ/8KgcAgJmceE4IADA4ESEAgBkiBAAwQ4QAAGaIEADADBECAJghQgAAM0QIAGCGCAEAzBAhAIAZIgQAMEOEAABm/g922sEY+kNHLwAAAABJRU5ErkJggg=="
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 87
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "在测试集上的表现",
   "id": "c07561174d6d487d"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:30:54.536146Z",
     "start_time": "2025-01-08T07:30:54.525969Z"
    }
   },
   "cell_type": "code",
   "source": [
    "scorecard=[]\n",
    "for record in test_data_list:\n",
    "    all_values=record.split(',')\n",
    "    correct_label=int(all_values[0])\n",
    "    all_values=[float(value) for value in all_values[1:]]\n",
    "    inputs=numpy.asfortranarray(all_values)/255.0*0.99+0.01\n",
    "    outputs=n.query(inputs)\n",
    "    label=numpy.argmax(outputs)\n",
    "    if label==correct_label:\n",
    "        scorecard.append(1)\n",
    "    else:\n",
    "        scorecard.append(0)\n",
    "print(scorecard)\n",
    "scorecard_array=numpy.array(scorecard)\n",
    "print(\"准确率：\",scorecard_array.sum()/scorecard_array.size)\n"
   ],
   "id": "c0f0cc4bd7090fcb",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0, 0, 0, 1, 0, 0, 0, 0, 0, 0]\n",
      "准确率： 0.1\n"
     ]
    }
   ],
   "execution_count": 88
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "在mnist数据集上训练测试",
   "id": "2f0098567e3c111"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:53:14.140558Z",
     "start_time": "2025-01-08T07:51:23.283929Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#定义网络\n",
    "input_nodes=784\n",
    "hidden_nodes=100\n",
    "output_nodes=10\n",
    "learning_rate=0.1\n",
    "epochs=5\n",
    "nn=neuralnetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)\n",
    "#加载训练集\n",
    "training_data_file=open(r'E:\\sorce\\dataset\\mnist_dataset\\MNIST\\mnist_train.csv','r')\n",
    "training_data_list=training_data_file.readlines()\n",
    "training_data_file.close()\n",
    "#训练网络\n",
    "for epoch in range(epochs):\n",
    "    for record in training_data_list:\n",
    "        all_values=record.split(',')\n",
    "        target=numpy.zeros(10)+0.01\n",
    "        target[int(all_values[0])]=0.99\n",
    "        all_values=[float(value) for value in all_values[1:]]\n",
    "        inputs=numpy.asfortranarray(all_values)/255.0*0.99+0.01\n",
    "        nn.train(inputs,target)\n",
    "\n"
   ],
   "id": "c1ab69a755fc5852",
   "outputs": [],
   "execution_count": 89
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-08T07:58:26.135527Z",
     "start_time": "2025-01-08T07:58:23.609681Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#加载测试集\n",
    "test_data_file=open(r'E:\\sorce\\dataset\\mnist_dataset\\MNIST\\mnist_test.csv','r')\n",
    "test_data_list=test_data_file.readlines()\n",
    "test_data_file.close()\n",
    "#测试准确率\n",
    "scorecard=[]\n",
    "for record in test_data_list:\n",
    "    all_values=record.split(',')\n",
    "    correct_label=int(all_values[0])\n",
    "    all_values=[float(value) for value in all_values[1:]]\n",
    "    inputs=numpy.asfortranarray(all_values)/255.0*0.99+0.01\n",
    "    outputs=nn.query(inputs)\n",
    "    label=numpy.argmax(outputs)\n",
    "    if label==correct_label:\n",
    "        scorecard.append(1)\n",
    "    else:\n",
    "        scorecard.append(0)\n",
    "print(scorecard)\n",
    "scorecard_array=numpy.array(scorecard)\n",
    "print(\"准确率：\",scorecard_array.sum()/scorecard_array.size)"
   ],
   "id": "8af64a468da07cdd",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n",
      "准确率： 0.9662\n"
     ]
    }
   ],
   "execution_count": 91
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "ed8432e2931032ab"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
